#!/bin/bash

mkdir -p /home/software/memcached

cd /home/software/memcached

wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable

./configure
make && make install

wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
tar zxvf memcached-1.4.15.tar.gz
cd memcached-1.4.15

./configure --prefix=/usr/local/memcached --enable-64bit --with-libevent=/usr/local
make install -j16

ln -s /usr/local/memcached/bin/memcached /usr/local/bin/memcached